<?php

session_start();
   $list = $_SESSION['list'];


$conn = mysql_connect('studentdb.gl.umbc.edu', 'chrimo1', 'chrimo1');
if (!$conn) {
   die('Could not connect');
}

$db_selected = mysql_select_db('chrimo1', $conn);
if (!$db_selected) {
   die ('Can\'t use chrimo1');
}

$idNum = $_POST['idNum'];
$gameName = mysql_real_escape_string($_POST['gameName']);
$developer = mysql_real_escape_string($_POST['developer']);
$releaseDate = $_POST['releaseDate'];
$description = mysql_real_escape_string($_POST['description']);
$system = $_POST['system'];
$quantity = $_POST['quantity'];
$price = $_POST['price'];
$imageURL = mysql_real_escape_string($_POST['imageURL']);
$multiplayer = $_POST['multiplayer'];
$singleplayer = $_POST['singleplayer'];
$cooperative = $_POST['cooperative'];
$beatemUp = $_POST['beatemUp'];
$rpg = $_POST['rpg'];
$platform = $_POST['platform'];
$action = $_POST['action'];
$strategy = $_POST['strategy'];
$shootemUp = $_POST['shootemUp'];
$buildingSim = $_POST['buildingSim'];
$scrollingShooter = $_POST['scrollingShooter'];
$racing = $_POST['racing'];
$sports = $_POST['sports'];

$sql = "UPDATE gameInventory SET gameName ='$gameName', developer ='$developer', releaseDate ='$releaseDate ', description='$description', quantity='$quantity', price='$price', imageURL='$imageURL', system='$system', multiplayer='$multiplayer', singleplayer='$singleplayer', cooperative='$cooperative', beatemUp='$beatemUp', rpg='$rpg', platform='$platform', action='$action', strategy='$strategy', shootemUp='$shootemUp', buildingSim='$buildingSim', scrollingShooter='$scrollingShooter', racing='$racing', sports='$sports' WHERE idNum='$idNum'";

$exec = mysql_query($sql, $conn);
echo '<body style="background-color:black">';
if ($exec == TRUE){
  echo '<center><h1 style="color:green; font-size:42">Item Updated!</h1></center>';
}
else{
  echo '<center><h1 style="color:red; font-size: 42">ERROR! Game not Updated</h1></center>';
  
}
echo '<form method="get"  action="listInventory.php">'; 
  echo '<input type="hidden" name="choice" value="'; echo $list; echo '">';
  echo '<center><input type="image" name="submit" src="images/Continue.PNG" border="0"></center>';
echo '</form>';
echo '<center><h2><a style="color:gold" href="admin.html"><img src="images/admin_button.png"></a></h2></center><br/>';


?>